home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.5)
-
- __revision__ = '$Id: extension.py 37623 2004-10-14 10:02:08Z anthonybaxter $'
- import os
- import string
- import sys
- from types import *
-
- try:
- import warnings
- except ImportError:
- warnings = None
-
-
- class Extension:
-
- def __init__(self, name, sources, include_dirs = None, define_macros = None, undef_macros = None, library_dirs = None, libraries = None, runtime_library_dirs = None, extra_objects = None, extra_compile_args = None, extra_link_args = None, export_symbols = None, swig_opts = None, depends = None, language = None, **kw):
- self.name = name
- self.sources = sources
- if not include_dirs:
- pass
- self.include_dirs = []
- if not define_macros:
- pass
- self.define_macros = []
- if not undef_macros:
- pass
- self.undef_macros = []
- if not library_dirs:
- pass
- self.library_dirs = []
- if not libraries:
- pass
- self.libraries = []
- if not runtime_library_dirs:
- pass
- self.runtime_library_dirs = []
- if not extra_objects:
- pass
- self.extra_objects = []
- if not extra_compile_args:
- pass
- self.extra_compile_args = []
- if not extra_link_args:
- pass
- self.extra_link_args = []
- if not export_symbols:
- pass
- self.export_symbols = []
- if not swig_opts:
- pass
- self.swig_opts = []
- if not depends:
- pass
- self.depends = []
- self.language = language
- if len(kw):
- L = kw.keys()
- L.sort()
- L = map(repr, L)
- msg = 'Unknown Extension options: ' + string.join(L, ', ')
- if warnings is not None:
- warnings.warn(msg)
- else:
- sys.stderr.write(msg + '\n')
-
-
-
-
- def read_setup_file(filename):
- parse_makefile = parse_makefile
- expand_makefile_vars = expand_makefile_vars
- _variable_rx = _variable_rx
- import distutils.sysconfig
- TextFile = TextFile
- import distutils.text_file
- split_quoted = split_quoted
- import distutils.util
- vars = parse_makefile(filename)
- file = TextFile(filename, strip_comments = 1, skip_blanks = 1, join_lines = 1, lstrip_ws = 1, rstrip_ws = 1)
- extensions = []
- while None:
- line = file.readline()
- if line is None:
- break
-
- if _variable_rx.match(line):
- continue
-
- if line[-1] == line[-1]:
- pass
- elif line[-1] == '*':
- file.warn("'%s' lines not handled yet" % line)
- continue
-
- line = expand_makefile_vars(line, vars)
- words = split_quoted(line)
- module = words[0]
- ext = Extension(module, [])
- append_next_word = None
- for word in words[1:]:
- if append_next_word is not None:
- append_next_word.append(word)
- append_next_word = None
- continue
-
- suffix = os.path.splitext(word)[1]
- switch = word[0:2]
- value = word[2:]
- if suffix in ('.c', '.cc', '.cpp', '.cxx', '.c++', '.m', '.mm'):
- ext.sources.append(word)
- continue
- if switch == '-I':
- ext.include_dirs.append(value)
- continue
- if switch == '-D':
- equals = string.find(value, '=')
- if equals == -1:
- ext.define_macros.append((value, None))
- else:
- ext.define_macros.append((value[0:equals], value[equals + 2:]))
- equals == -1
- if switch == '-U':
- ext.undef_macros.append(value)
- continue
- if switch == '-C':
- ext.extra_compile_args.append(word)
- continue
- if switch == '-l':
- ext.libraries.append(value)
- continue
- if switch == '-L':
- ext.library_dirs.append(value)
- continue
- if switch == '-R':
- ext.runtime_library_dirs.append(value)
- continue
- if word == '-rpath':
- append_next_word = ext.runtime_library_dirs
- continue
- if word == '-Xlinker':
- append_next_word = ext.extra_link_args
- continue
- if word == '-Xcompiler':
- append_next_word = ext.extra_compile_args
- continue
- if switch == '-u':
- ext.extra_link_args.append(word)
- if not value:
- append_next_word = ext.extra_link_args
-
- value
- if suffix in ('.a', '.so', '.sl', '.o', '.dylib'):
- ext.extra_objects.append(word)
- continue
- file.warn("unrecognized argument '%s'" % word)
-
- continue
- return extensions
-
-